feat(examples): Add P2P Calc, EtherCalc-powered collaborative spreadsheet example using py-libp2p#1382
Merged
seetadev merged 18 commits intoJul 12, 2026
Conversation
Added a new issue template for the DMP 2026 project, including fields for project description, goals, setup, expected outcomes, acceptance criteria, implementation details, mockups, product name, organization name, governance domain, technical skills required, mentors, and categories.
Adds examples/p2pcalc/ — a working integration layer that replaces EtherCalc's centralised Redis pub-sub sync with py-libp2p GossipSub. Architecture: - operation.py: SocialCalc command encoding with Hybrid Logical Clocks and MessagePack serialisation - crdt.py: Multi-Value Register (cell conflicts) + RGA (structural ops) - adapter.py: Redis <-> GossipSub bridge (zero EtherCalc source changes) - p2p_node.py: libp2p host with GossipSub v2.0, topic-per-sheet design - state_sync.py: two-phase late-joiner snapshot + op-log replay Innovations beyond baseline: - HLC timestamps instead of wall clocks (causal ordering across peers) - MVR conflict detection surfaces concurrent edits rather than silently dropping them (unlike LWW) - RGA for row/col structural ops handles concurrent inserts correctly - Causal buffering ensures out-of-order ops are applied correctly - Echo loop prevention at Redis inject layer - Local op-log WAL for crash recovery without full network resync Tests: 42 unit tests, no network or Redis required. Closes #34
- main.py: split long help string (E501, was 103 chars) - state_sync.py: replace os.path.join/makedirs with pathlib.Path (path-audit P1) - test_p2pcalc.py: replace os.path.dirname/abspath with pathlib.Path (path-audit P1) - p2pcalc/__init__.py: add module docstring
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Member
Author
|
@yashksaini-coder, @DZDasherKTB : Thank you guys for this initiative. We will evolve this project with Filecoin and IPFS clients in the coming days and will discuss it in the upcoming calls. Also, wish to thank @sumanjeet0012 for his support. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds P2P Calc to the
examples/directory of py-libp2p as a comprehensive reference application built on top of EtherCalc. The example extends EtherCalc with native py-libp2p networking, demonstrating how collaborative spreadsheets can operate over secure peer-to-peer connections.Unlike basic networking examples, P2P Calc showcases py-libp2p in a real-world application, providing developers with an end-to-end example of building decentralized collaborative software.
What's Included
examples/.Why This Matters
While py-libp2p includes examples covering networking primitives, developers often look for complete applications that demonstrate how these components fit together. P2P Calc fills this gap by providing a practical, production-inspired example of decentralized collaboration.
This example will help developers understand:
Impact
P2P Calc becomes a flagship example for the py-libp2p ecosystem, making it easier for new contributors to learn the library through a familiar application. It also supports broader ecosystem growth by demonstrating a compelling real-world use case for py-libp2p, encouraging adoption across collaborative software, distributed systems, AI agent frameworks, and Web3 applications.
This example aligns with ongoing efforts to expand the py-libp2p ecosystem through high-quality developer tooling, practical reference implementations, and educational resources.